//
//  DataSource.m
//  复习
//
//  Created by Justsoso on 16/3/11.
//  Copyright © 2016年 Justsoso. All rights reserved.
//

#import "DataSource.h"


@implementation DataSource

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.dict = [NSDictionary dictionaryWithContentsOfFile:@"dictionary.plist"];
        self.keys = [[self.dict allKeys] sortedArrayUsingSelector:@selector(compare:)];
    }
    return self;
}

- (int)section
{
    return self.dict.count;
}
- (int)line:(int)section
{
    NSString *key = self.keys[section];
    NSArray *arr = self.dict[key];
    return arr.count;
}
- (NSString *)lineContent:(int)section andLine:(int)line
{
    NSString *key = self.keys[section];
    NSArray *arr = self.dict[key];
    return arr[line];
}
- (NSString *)sectionContent:(int)section
{
    return self.keys[section];
}

@end
